package joctave.toolbox.io;

import joctave.core.tokens.*;
import joctave.core.tokens.numbertokens.DoubleNumberToken;
import joctave.core.functions.ExternalFunction;
import joctave.core.interpreter.GlobalValues;

import java.io.*;

public class fullfile extends ExternalFunction
{
	public OperandToken evaluate(Token[] operands, GlobalValues globals)
	{

        if (getNArgIn(operands) != 2)
			throwMathLibException("fullfile: number of arguments != 2");

		if (!(operands[0] instanceof CharToken)||!(operands[1] instanceof CharToken)) 
            throwMathLibException("fullfile: argument must be a string");

        String path = ((CharToken)operands[0]).toString();
        String file = ((CharToken)operands[1]).toString();

        return new CharToken(path+"\\"+file);		

	} // end eval
}

/*
@GROUP
IO
@SYNTAX
fullfile(path,filename)
@DOC
Returns the full filename
@EXAMPLES
<programlisting>
fullfile("c:\dog","bar.txt");
</programlisting>
@NOTES
@SEE
*/

